﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace YBApproval
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        private readonly string path = HttpContext.Current.Request.ApplicationPath;
        
        /// <summary>
        /// GetFixedApplicationPath
        /// </summary>
        /// <returns></returns>
        //protected string GetFixedApplicationPath()
        //{
            //var ext = new PathExtension();
            //return ext.GetFixedApplicationPath(path);
        //}


        /// <summary>
        /// SetContentTitle
        /// </summary>
        /// <param name="title"></param>
        public void SetContentTitle(string title)
        {
            ltlContentTitle.Text = title;
        }

        /// <summary>
        /// Set content title icon url
        /// </summary>
        /// <param name="pictureName"></param>
        internal void SetImageTitle(string pictureName)
        {
            //titleIcon.Src = "~/images/" + pictureName;
            //this.titleIcon.Style.Add("behavior", "url(iepngfix.htc)");
        }

        /// <summary>
        /// Page_Init
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Init(object sender, EventArgs e)
        {
            //if (!Page.IsPostBack)
            //{
            //    LoadBroadCast();
            //}
        }

        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (YBPSession.Instance.CurrentUser != null)
            {
                lt_UserName.Text = YBPSession.Instance.CurrentUser.Name;
            }
            else
            {
                Response.Redirect("~/logout.aspx");
            }
        }


        /// <summary>
        /// LoadBroadCast
        /// </summary>
        private void LoadBroadCast()
        {
            ////load category from cache
            //Category[] categories = CachedParameters.AllCategorys;

            //var dt = new DataTable("category");
            //dt.Columns.Add("word");
            //dt.Columns.Add("value");

            //dt.Rows.Add("All Types", "All Types");
            //for (int i = 0; i < categories.Length; i++)
            //{
            //    Category categorie = categories[i];
            //    dt.Rows.Add(categorie.Name, categorie.Name);
            //}

            //// add to table
           // CategoryTable = dt;
        }

        
        protected void lbFAQ_Click(object sender, EventArgs e)
        {
            //Response.Redirect("FAQ.aspx");
        }

    }
}
